_realname=oatpp
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.3.0
pkgrel=2
pkgdesc="Oat++ is an open-source C++ web framework for highly scalable and resource-efficient web applications."
url="https://github.com/oatpp/oatpp"
license=('Apache')
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-cmake"
  "${MINGW_PACKAGE_PREFIX}-ninja"
)
source=("https://github.com/oatpp/oatpp/archive/refs/tags/${pkgver}.zip")
sha256sums=('d2b0e59cb9fd55999f56c57b6580783542d1e653d3ca888d69c19170691d7346')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  mkdir -p build
  cd build

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    ${MINGW_PREFIX}/bin/cmake.exe \
      -GNinja \
      -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
      -DCMAKE_BUILD_TYPE=Release \
      ..

  cmake --build .
}

package() {
  cd "$srcdir/${_realname}-${pkgver}/build"
  DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake.exe --install .
}
